namespace CoreManager.Core.Captcha
{
    /// <summary>
    /// 验证码服务接口
    /// </summary>
    public interface ICaptchaService
    {
        /// <summary>
        /// 生成验证码
        /// </summary>
        /// <param name="length">验证码长度</param>
        /// <returns>验证码结果</returns>
        CaptchaResult GenerateCaptcha(int length = 4);

        /// <summary>
        /// 验证验证码
        /// </summary>
        /// <param name="requestId">请求ID</param>
        /// <param name="captchaCode">用户输入的验证码</param>
        /// <returns>验证结果</returns>
        bool ValidateCaptcha(string requestId, string captchaCode);
    }

    /// <summary>
    /// 验证码结果
    /// </summary>
    public class CaptchaResult
    {
        /// <summary>
        /// 请求ID
        /// </summary>
        public string RequestId { get; set; } = string.Empty;

        /// <summary>
        /// 验证码图片（Base64编码）
        /// </summary>
        public string CaptchaImage { get; set; } = string.Empty;

        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime ExpiresAt { get; set; }
    }
}